<?php
namespace app\mobile\middleware;

use think\Request;
use think\facade\Log;
header("content-type:text/html;charset=utf-8");

/**
 * 检测白名单
 * Class CheckWhite
 *
 * @package app\mobile\middleware
 */
class CheckUser
{
    
    use \app\common\traits\JumpTrait;

    public function handle(Request $request, \Closure $next)
    {
        $params = $request->param();
        
        $uid = $params['uid'];
        
        $user = \app\admin\model\SybUser::where([
            "id" => $uid
        ])->find();
        
        if (empty($user)) {
            return result(- 1, '账号不存在');
        }
        
        if ($user['is_freeze'] == 2) {
            return result(- 1, '账号已冻结');
        }
        
        return $next($request);
    }
}